﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script>
        function resetFrom()
        {
            var form = document.getElementById("frmRegisder");
            form.reset();
        }
        function register()
        {
            var form = document.getElementById("frmRegisder");
            if (form.elements["username"].value == "" || form.elements["password"].value == "")
            {
                alert("用户名或密码不能为空");
                return false;
            }
            if (form.elements["password"].value != form.elements["confirm"].value) {
                alert("两次密码不一致");
                return false;
            }
        }
    </script>
</head>
<body>
    <form id="frmRegisder">
        <table border="1" align="center">
            <tr>
                <td colspan="2">用户注册</td>
            </tr>
            <tr>
                <td>用户名</td>
                <td><input type="text" name="username" /></td>
            </tr>
            <tr>
                <td>密码</td>
                <td><input type="password" name="password" /></td>
            </tr>
            <tr>
                <td>确认密码</td>
                <td><input type="password" name="confirm" /></td>
            </tr>
            <tr>
                <td>性别</td>
                <td><input type="radio" name="sex" value="男" />男<input type="radio" name="sex" value="女" />女</td>
            </tr>
            <tr>
                <td>职业</td>
                <td><select name="job"><option>教师</option><option>学生</option></select></td>
            </tr>
            <tr>
                <td>订阅消息</td>
                <td><input type="checkbox"/></td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <button onclick="register()">提交</button>
                    <button onclick="resetFrom()">重置</button>
                </td>
            </tr>

        </table>
    </form>
</body>
</html>
